var car=function(){
	this.canvas  = document.getElementById("viewware");
	this.ctx = this.canvas.getContext("2d");
	this.ware_heng_width = 8;
}

car.prototype.init=function(){
	
}

car.prototype.draw=function(){
	this.ctx.clearRect(0,0,this.width,this.height);
	this.drawWareHome();
}


 car.prototype.drawWareHome=function(){
	 let ware_width = this.width*0.8;
	 let ware_height = this.height;
	 let ware_wudinggao = ware_height/5; //屋顶高
	 let ware_hengliang = ware_height/7;//中间横梁高
	 let rammaing_height = ware_height - ware_wudinggao-ware_hengliang; //剩余的高度
	 let rammaing_y = ware_wudinggao +ware_hengliang; //剩余的高度的坐标
	 let ware_center_x = ware_width/2;
	 let ware_center_y = ware_height/2;
	 
	 //绘制仓库房子
	 this.ctx.save();
	 this.ctx.fillStyle = "#1ec0ff99";
	 //屋顶三角型
	  this.ctx.beginPath();
	 this.ctx.moveTo(ware_center_x,0);
	 this.ctx.lineTo(ware_width,ware_wudinggao);
	 this.ctx.lineTo(0,ware_wudinggao);
	 this.ctx.closePath();
	 this.ctx.fill();
	 //屋顶的块
	 this.ctx.beginPath();
	 this.ctx.rect(0,ware_wudinggao,ware_width,ware_hengliang);	
	 this.ctx.fill();
	 //左侧的支柱
	 this.ctx.beginPath();
	 this.ctx.rect(0,rammaing_y,this.ware_heng_width,rammaing_height);
	 this.ctx.fill();
	 //右边透出来的
	 this.ctx.beginPath();
	 this.ctx.rect(ware_width-this.ware_heng_width,rammaing_y,this.ware_heng_width,this.ware_heng_width);
	 this.ctx.fill();
	  this.ctx.restore();
	  
	  this.ctx.save();
	 //绘制上头文字
	 this.ctx.beginPath();
	 this.ctx.font = "10px bold Arial";
	 this.ctx.fillStyle = "#1ec0ff";
	 this.ctx.textBaseline = 'middle';  //垂直居中
	 this.ctx.textAlign="center"; //水平居中
	 if(vue.isInwareHome){
		 this.ctx.fillText("入",ware_center_x,rammaing_y/2);
	 }else{
		 this.ctx.fillText("出",ware_center_x,rammaing_y/2);
	 }
	 
	 this.ctx.restore();
	 
	
	 
	 
	 
	 
 }

car.prototype.size=function(){
	this.rectc = this.canvas.getBoundingClientRect();
	let rad = window.devicePixelRatio;
	this.width = this.rectc.width;
	this.height = this.rectc.height;
	
	this.w_center = this.width/2;
	this.w_height = this.height/2;
	
	this.canvas.style.width = this.width+"px";
	this.canvas.style.height = this.height+"px";
	
	this.canvas.width = this.width * rad;
	this.canvas.height = this.height * rad;
	this.ctx.scale(rad,rad);
	
}